package edu.hawaii.duedates.datastore;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
 * Some tests to check that the DueDatesConfig class functions as expected.
 * @author Daniel Arakaki, Jeho Jung, Arthur Shum, Daniel Tian
 *
 */
public class TestDueDatesConfig {

  private final DueDatesConfig dueDatesConfig = new DueDatesConfig();
  
  /**
   * Test an empty DueDatesConfig.
   * @throws Exception If an error occurs during the test.
   */
  @Test
  public void testEmptyConfig() throws Exception {
    assertNull("smtpServer should be null", dueDatesConfig.getSmtpServer()); 
    assertTrue("Users should be empty", dueDatesConfig.getUsers().isEmpty()); 
  }
  
  /**
   * Test the set methods and return values.
   * @throws Exception If an error occurs during the test.
   */
  @Test
  public void testNormal() throws Exception {
    dueDatesConfig.setSmtpServer("mail.hawaii.edu");
    User user = new User("testName", "testEmail", "testPassword");
    dueDatesConfig.addUser(user);
    
    assertEquals("Return smtpServer", "mail.hawaii.edu", dueDatesConfig.getSmtpServer());
    assertFalse("Users shouldn't be empty", dueDatesConfig.getUsers().isEmpty());
  }
}
